﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SeniorGenericConstraint
{
    //泛型约束
    class MyGenericClassForClass<T> where T : class
    {

    }
    class MyGenericClassForValue<U>where U:struct
    {

    }


    internal class Program
    {
        static void Main(string[] args)
        {
            //class关键字表示T必须是引用类型，值类型特化不了
            //struct关键字表示U必须为值类型，其他类型的特化不了！！
            MyGenericClassForClass<string> myGenericClass = new MyGenericClassForClass<string>();
            MyGenericClassForValue<int> myGenericClassForValue = new MyGenericClassForValue<int>();
        }
    }
}
